import { PureComponent } from 'react'
import SingleTable from 'components/table/index'
import { Input, Button, Select, Divider } from 'antd'
import CustomerModal from 'components/modal/customerModal'
import styles from './customerMarketing.less'
const { Option } = Select
export default class CoustomerMarketing extends PureComponent {
    state = {
        visible: false
    }
    renderModal(){
        const { visible } = this.state
        return(
            <CustomerModal 
                visible={visible}
                onOk={this.handleOk}
                onCancel={this.handleCancel}
            />
        )
    }
    handleCancel = () => {
        this.setState({ visible: false })
    }
    handleOk = () => {
        this.setState({ visible: false })
    }
    handleAdd = () => {
        this.setState({ visible: true })
    }
    render(){
        const columns = [
            {
                key: 'gmtCreate',
                title: '会员号',
                dataIndex: 'gmtCreate',
                align: 'center',
            },
            {
                key: 'operationTypeName',
                title: '优惠类型',
                dataIndex: 'operationTypeName',
                align: 'center',
            },
            {
                key: 'creatorName',
                title: '预付优惠',
                dataIndex: 'creatorName',
                align: 'center',
            },
            {
                key: '4',
                title: '到付优惠',
                dataIndex: 'creatorName',
                align: 'center',
            },
            {
              key: '5',
              title: '优惠开始时间',
              dataIndex: 'creatorName',
              align: 'center',
            },
            {
              key: '6',
              title: '优惠结束时间',
              dataIndex: 'creatorName',
              align: 'center',
            },
            {
                key: '7',
                title: '重量等级(KG)',
                dataIndex: 'creatorName',
                align: 'center',
            },
            {
                key: '8',
                title: '支付类型',
                dataIndex: 'creatorName',
                align: 'center',
            },
            {
                key: '9',
                title: '操作',
                dataIndex: 'creatorName',
                align: 'center',
                render: (text, record) => (
                    <span>
                      <a >编辑</a>
                      <Divider type="vertical" />
                      <a>删除</a>
                    </span>
                ),
            },
          ]
          const dataList = []
        return(
            <div className={styles.singleTask}>
                <div className={styles.singleTaskBox}>
                    <h2>大客户营销</h2>
                </div>
                <div className={styles.singleTaskSearch}>
                    <div className={styles.singleTaskSin}>
                        <span className={styles.singleTaskSpan}>会员号：</span>
                        <Input className={styles.singleTaskInput}/>
                    </div>
                    <div className={styles.singleTaskSin} style={{marginLeft: '28px'}}>
                        <span className={styles.singleTaskSpan}>优惠类型：</span>
                        <Select className={styles.singleTaskInput}>
                            <Option value="value">value</Option>
                        </Select>
                    </div>
                </div>
                <Button type="primary" icon="search" style={{margin: '0 0 24px 24px'}}>查询</Button>
                <Button  icon="plus" style={{marginLeft: '24px'}} onClick={this.handleAdd}>新增</Button>
                <div className={styles.singleTaskTable}>
                    <SingleTable
                        data={{ list: dataList }}
                        columns={columns}
                    />
                </div>
                {this.renderModal()}
            </div>
        )
    }
}